load objmat
if(S.bioheat==0)
    if(S.needle_num==2)
        n_x    = 10;                           % 'n_x' state
        limits=[S.minX,S.maxX;S.minY,S.maxY;S.minZ,S.maxZ;S.minX,S.maxX;S.minY,S.maxY;S.minZ,S.maxZ;0,180;0,180;0,180;0,180;];
    elseif(S.needle_num==3)
        n_x  = 15;
        limits=[S.minX,S.maxX;S.minY,S.maxY;S.minZ,S.maxZ;S.minX,S.maxX;S.minY,S.maxY;S.minZ,S.maxZ;0,180;0,180;0,180;0,180;...
            S.minX,S.maxX;S.minY,S.maxY;S.minZ,S.maxZ;0,180;0,180;];  % 3 needles case
    end
end

if(S.bioheat==1)
        Data.xlow=[S.boundx+S.b S.boundy+S.b S.boundz+S.b 0 0]; 
        Data.xup=[ max(S.x)-min(S.x)+S.boundx-S.b  max(S.y)-min(S.y)+S.boundy-S.b  max(S.z)-min(S.z)+S.boundz-S.b 180 180];
        if(S.needle_num==2)
            n_x    = 10;                           % 'n_x' state
            Data.xlow = [Data.xlow Data.xlow];
            Data.xup = [Data.xup Data.xup];
        elseif(S.needle_num==3)
            n_x  = 15;
            Data.xlow = [Data.xlow Data.xlow Data.xlow];
            Data.xup = [Data.xup Data.xup Data.xup];
        elseif(S.needle_num==4)
            n_x  = 20;
            Data.xlow = [Data.xlow Data.xlow Data.xlow Data.xlow];
            Data.xup = [Data.xup Data.xup Data.xup Data.xup];
        elseif(S.needle_num==5)
            n_x  = 25;
            Data.xlow = [Data.xlow Data.xlow Data.xlow Data.xlow Data.xlow];
            Data.xup = [Data.xup Data.xup Data.xup Data.xup Data.xup];
        end
end
if(S.bioheat==1)
    f=@(v) bioheat_obj(v);
    limits=[Data.xlow',Data.xup'];
elseif(S.bioheat==0)
    f=@(v) simulated_obj(v);
end
obj    = 0;   
nf      = 1;                 % length of the output vector 'f(x,y)'
mu      = 5;               % parent population size
lambda  = 5;               % offspring population size
gen     = S.runs;               % number of generations
sel     = '+';               % Selection scheme (Pag. 78 in (BACK))
rec_obj = 3;                 % Type of recombination to use on object
                             % variables (Pag. 74 in (BACK))
                             % See 'recombination.m'
rec_str = 4;                 % Type of recombination to use on strategy
                             % parameters (Pag. 74 in (BACK))
u       = 0;                 % external excitation
[min_x, min_f, off, EPS,idx] = evolution_strategy(f, mu, lambda, gen, sel, rec_obj, rec_str, u, obj, nf, n_x, limits);